import Vue from 'vue'
import VueRouter from 'vue-router'
import Layout from '@/views/layout/Index.vue'
import Login from '@/views/login/Index.vue'
import Home from '@/views/home/Home.vue'


const Product = ()=>import('@/views/Product/IndexProduct.vue')
const List = ()=>import('@/views/Product/List/IndexList.vue')
const Category = ()=>import('@/views/Product/Category/IndexCategory.vue')

const Order = ()=>import('@/views/Order/IndexOrder.vue')
const OrderList = ()=>import('@/views/Order/OrderList/IndexOrderList.vue')
const Collect = ()=>import('@/views/Order/Collect/IndexCollect.vue')
const Examine = ()=>import('@/views/Order/Examine/IndexExamine.vue')

const Advert = ()=>import('@/views/advert/Indexadvert.vue')
const AdvertList = ()=>import('@/views/advert/advertList/IndexadvertList.vue')

Vue.use(VueRouter)

const routes = [
     {
      path:'/',
      component:Layout,
      children:[
        {
          path:'/',
          name:'home',
          component:Home
        },

        {
          path:'/product',//产品管理
          name:'product',
          component:Product,
          children:[
            {
              path:'list',//访问路径： /product/list
              name:'list',
              component:List
            },
            {
              path:'category',//访问路径： /product/category
              name:'category',
              component:Category
            }
          ]
        },

        {
          path:'/order',//订单管理
          name:'order',
          component:Order,
          children:[
            {
              path:'order-List',//访问路径： /order/orderlist
              name:'order-List',
              component:OrderList
            },
            {
              path:'collect',//访问路径：  /order/collect
              name:'collect',
              component:Collect
            },
            {
              path:'examine',//访问路径：  /order/Examine
              name:'examine',
              component:Examine
            }

          ]
        },

        {
          path:'/advert',//广告管理
          name:'advert',
          component:Advert,
          children:[
            {
              path:'advert-list',//访问路径： /advert/advertlist
              name:'advert-list',
              component:AdvertList
            }
          ]
        }
      ]
     },
     {
      path:'/login',
      name:'login',
      component:Login
     }
]

const router = new VueRouter({
  mode: 'history',
  base: process.env.BASE_URL,
  routes
})

export default router
